﻿using AutoMapper;
using AbpApplication_Module.Dto;

namespace AbpApplication_Module
{
    public class ProjectProfile : Profile
    {
        public ProjectProfile()
        {
            //dto和商品模型之间的映射  //配置子类映射
            CreateMap<ProductImage, ProductImageDto>().ForMember(dist => dist.ProductImageOrders,opt => opt.MapFrom(src => src.ProductImageOrders));
            CreateMap<ProductImageDto, ProductImage>().ForMember(dist => dist.ProductImageOrders, opt => opt.MapFrom(src => src.ProductImageOrders)); ;
            ////配置子类映射
            CreateMap<ProductImageCreateDto, ProductImage>().ForMember(dist => dist.ProductImageOrders, opt => opt.MapFrom(src => src.ProductImageOrders));
            ////配置子类映射
            CreateMap<ProductImageUpdateDto, ProductImage>().ForMember(dist => dist.ProductImageOrders, opt => opt.MapFrom(src => src.ProductImageOrders));

            //imageOrderDto
            CreateMap<ProductImageOrderDto, ProductImageOrder>();
            CreateMap<ProductImageOrder, ProductImageOrderDto>();
        }
    }
}
